package com.wesley.fritesfinder;

import java.util.ArrayList;

import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;
import com.wesley.fritesfinder.controller.FritesController;
import com.wesley.fritesfinder.model.FoodShop;
import com.wesley.fritesfinder.model.MyItemizedOverlay;

public class FritesMap extends MapActivity {
	private FritesController fritesController;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        MapView mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
        
        fritesController = new FritesController();
        ArrayList<FoodShop> foodshops = fritesController.retrieveActionPoints();
        MyItemizedOverlay itemizedOverlay = new MyItemizedOverlay(getResources().getDrawable(R.drawable.frite_normal), getApplicationContext());
        
        for(FoodShop fs: foodshops) {
        	itemizedOverlay.addOverlay(new OverlayItem(new GeoPoint(fs.getDegreesLatitude(), fs.getDegreesLongitude()), fs.getName(), "Rating: " + fs.getRating()));
        }
        
        itemizedOverlay.populateOverlay();
        mapView.getOverlays().add(itemizedOverlay);
    }

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}
    
    
}